home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Applications / Portable Patmos 1.1 / patmos-src / src / ftruncate.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-19  |  504 b   |  26 lines  |  [TEXT/KAHL]

  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <fcntl.h>
  4. #include "crtlocal.h"
  5.  
  6. int ftruncate(int fd, off_t off)
  7.     {
  8.     OSErr    err;
  9.     ParamBlockRec   pbr;
  10.     if (crt_fd_tab[fd].flags & O_PIPE)
  11.         {
  12.         return 0;
  13.         }
  14.     if (crt_fd_tab[fd].flags & O_CATALOG)
  15.         {
  16.         return 0;
  17.         }
  18.     pbr.ioParam.ioRefNum = crt_fd_tab[fd].fd;
  19.     pbr.ioParam.ioPosMode = fsFromStart;
  20.     pbr.ioParam.ioPosOffset = off;
  21.     pbr.ioParam.ioMisc = (Ptr)off;
  22.     err = PBSetEOFSync(&pbr);
  23.     errtran(err);
  24.     return err ? -1:0;
  25.     }    
  26.